package com.sss.hloster07;

import java.util.*;
//定义一个姓名比较器
public class NameComparator implements Comparator{
//实现Comparator接口的compare()方法
	public int compare(Object op1,Object op2) {
		Student eOp1=(Student)op1;
		Student eOp2=(Student)op2;
		//通过调用String类的compareTo()方法进行比较
		return eOp1.stuName.compareTo(eOp2.stuName);
	}
}
